import '../models/home/recommend_video.dart';
import '../utils/http_util.dart';


// 视频相关接口
class VideoApi {

  static Future<List<RecommendVideoItemInfo>> getRecommendVideo() async {
    var data = await HttpUtil.get('/video/recommend');

    // 检查 data 是否为 List 类型
    if (data != null && data is List) {
      // 显式转换为 List<RecommendVideoItemInfo>
      return List<RecommendVideoItemInfo>.from(
        data.map((item) => RecommendVideoItemInfo.fromJson(item)),
      );
    } else {
      throw Exception('获取视频推荐失败或数据格式不正确');
    }
  }
}